﻿
namespace Resto.CostControl.Common.Context
{
    /// <summary>
    /// 用户信息上下文
    /// </summary>
    public static class UserContext
    {
         
        /// <summary>
        /// 当前登录用户的标识
        /// </summary>
        public static string CurrentUserCode
        {
            get
            {
                return "admin";

                //if (HttpContext.Current == null)
                //    return string.Empty;

                //return SSOClient.GetUserIdentity().Identity;
            }
        }

        private static string _CurrentUserName
        {
            get
            {
                return "管理员";

                //IUserService service = CentralismContext.ServiceFactory.CreateIUserServiceInstance();
                //IUser user = service.GetUser(CurrentUserCode);
                //if (user == null)
                //    return string.Empty;

                //return user.Name;
            }
        }

        /// <summary>
        /// 当前用户名
        /// </summary>
        public static string CurrentUserName
        {
            get
            {
                return _CurrentUserName;

                //if (HttpContext.Current == null)
                //    return string.Empty;

                //if (HttpContext.Current.Session[SessionConsts.Sessin_UserName_Key] == null)                
                //    HttpContext.Current.Session[SessionConsts.Sessin_UserName_Key] = _CurrentUserName;

                //return HttpContext.Current.Session[SessionConsts.Sessin_UserName_Key].ToString();
            }
        }
    }
}
